package com.kongfuzi.student.ui.gaspay;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.kongfuzi.student.R;
import com.kongfuzi.student.app.GasApplication;
import com.kongfuzi.student.ui.base.CustomerActionBarActivity;
import com.kongfuzi.student.support.utils.ArgsConstants;

import butterknife.Bind;
import butterknife.ButterKnife;

public class GasPayResultActivity extends CustomerActionBarActivity {

    private final static int SUCCESS = 1;
    private final static int FAILED = 2;
    @Bind(R.id.iv)
    ImageView mIv;
    @Bind(R.id.tv_result)
    TextView mTv_result;
    @Bind(R.id.tv_tip)
    TextView mTv_tip;
    @Bind(R.id.btn)
    Button mBtn;

    public static Intent startFailedInstance() {
        Intent intent = new Intent(GasApplication.getInstance(),GasPayResultActivity.class);
        return intent;
    }

    public static Intent startSuccessInstance() {
        Intent intent = new Intent(GasApplication.getInstance(),GasPayResultActivity.class);
        intent.putExtra(ArgsConstants.TYPE,SUCCESS);
        return intent;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gas_pay_result);
        int type = getIntent().getIntExtra(ArgsConstants.TYPE,FAILED);
        ButterKnife.bind(this);
        if(type == SUCCESS) {
            mIv.setImageResource(R.drawable.pay_success);
            mTv_result.setText("恭喜缴费成功！");
            mTv_tip.setVisibility(View.GONE);
        }
        mBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
